package
        com.zzc.sale.controller.apis;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hos.entity.stock.Provider;
import com.hos.vo.Result;
import com.zzc.sale.service.ProviderService;

import com.zzc.sale.vo.ProviderVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.web.bind.annotation.*;


import javax.annotation.Resource;
import java.util.List;


/**
 * @author：xIAO_ZHOU_TX
 * @date：Created in 2023/12/15 12:10
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/sale/api/erp/provider")
@Api(value = "厂家信息维护相关服务",tags = "厂家信息维护相关服务")
public class APIProviderController {
    @Resource
    private ProviderService providerService;

    @PostMapping("/listProviderForPage")
    @ApiOperation(value = "查询表格厂家所有信息")
    public Result<Page<Provider>> listProviderForPage(@RequestBody ProviderVo providerVo){
        return new Result<>(200,"查询成功",providerService.listProviderForPage(providerVo));
    }
    @PostMapping("/addProvider")
    @ApiOperation(value = "添加厂家信息")
    public Result<Integer> addProvider(Provider provider){
        return new Result<>(200,"添加成功",providerService.addProvider(provider));
    }
    @DeleteMapping("/deleteProviderByIds/{ids}")
    @ApiOperation(value = "根据id删除厂家信息")
    public Result<Integer> deleteProviderByIds(@PathVariable List<Long> ids){
        return new Result<>(200,"删除成功",providerService.deleteProviderByIds(ids));
    }
    @GetMapping("/getProviderById/{providerId}")
    @ApiOperation(value = "根据id查询单个厂家信息")
    public Result<Provider> getProviderById(@PathVariable Long providerId){
        return new Result<>(200,"查询成功",providerService.getProviderById(providerId));
    }
    @PutMapping("/updateProvider")
    @ApiOperation("修改厂商信息")
    public Result updateProvider(@RequestBody Provider provider){
        return new Result<>(200,"修改成功",providerService.updateProvider(provider));
    }
    @GetMapping("/selectAllProvider")
    @ApiOperation("查询所有有效的生产厂家信息")
    public Result selectAllProvider(){
        return new Result<>(200,"查询成功",providerService.selectAllProvider());
    }
}